"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_police_index = require("../../../api/police/index.js");
const config_app = require("../../../config/app.js");
const utils_tools = require("../../../utils/tools.js");
if (!Array) {
  const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
  const _easycom_uni_tag2 = common_vendor.resolveComponent("uni-tag");
  const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item");
  const _easycom_up_empty2 = common_vendor.resolveComponent("up-empty");
  const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
  const _easycom_up_list2 = common_vendor.resolveComponent("up-list");
  (_easycom_up_avatar2 + _easycom_uni_tag2 + _easycom_up_list_item2 + _easycom_up_empty2 + _easycom_up_gap2 + _easycom_up_list2)();
}
const _easycom_up_avatar = () => "../../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
const _easycom_uni_tag = () => "../../../uni_modules/uni-tag/components/uni-tag/uni-tag.js";
const _easycom_up_list_item = () => "../../../node-modules/uview-plus/components/u-list-item/u-list-item.js";
const _easycom_up_empty = () => "../../../node-modules/uview-plus/components/u-empty/u-empty.js";
const _easycom_up_gap = () => "../../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_list = () => "../../../node-modules/uview-plus/components/u-list/u-list.js";
if (!Math) {
  (_easycom_up_avatar + _easycom_uni_tag + _easycom_up_list_item + _easycom_up_empty + _easycom_up_gap + _easycom_up_list)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const uToastRef = common_vendor.ref(null);
    const data = common_vendor.reactive({
      queryParam: {
        // pageNum: 1,
        // pageSize: 10,
      },
      list: [],
      total: 0
    });
    const { queryParam, list, total } = common_vendor.toRefs(data);
    const getPoliceList = () => {
      common_vendor.index.showLoading({
        title: "加载中",
        mask: true
      });
      api_police_index.allPoliceOfCommunity(queryParam.value).then((res) => {
        common_vendor.index.hideLoading();
        const { data: data2 } = res;
        list.value = data2 ?? [];
      }).catch((err) => {
        common_vendor.index.hideLoading();
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    common_vendor.onLoad(() => {
      getPoliceList();
    });
    const scrolltolower = () => {
      getPoliceList();
    };
    const scanClockRecord = (userId) => {
      common_vendor.index.navigateTo({
        url: `/subPages/police/clock/clockRecord?userId=${userId}`
      });
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(list).length
      }, common_vendor.unref(list).length ? {
        b: common_vendor.f(common_vendor.unref(list), (item, index, i0) => {
          return common_vendor.e({
            a: "175db4df-2-" + i0 + "," + ("175db4df-1-" + i0),
            b: common_vendor.p({
              src: common_vendor.unref(config_app.imgPrefix) + item.avatar,
              shape: "circle",
              size: "111rpx",
              mode: "scaleToFit"
            }),
            c: common_vendor.t(item.userName),
            d: common_vendor.t(item.badgeNumber),
            e: item.dutyStatus != 3
          }, item.dutyStatus != 3 ? {
            f: "175db4df-3-" + i0 + "," + ("175db4df-1-" + i0),
            g: common_vendor.p({
              text: "在岗",
              type: "success",
              ["custom-style"]: "background-color: #33A954; border: none; color: #fff;font-size:25rpx; border-radius: 8rpx; height:35rpx; line-height:35rpx; padding: 4rpx 16rpx;"
            })
          } : {
            h: "175db4df-4-" + i0 + "," + ("175db4df-1-" + i0),
            i: common_vendor.p({
              text: "不在岗",
              type: "success",
              ["custom-style"]: "background-color: #BBBBBB; border: none; color: #fff;font-size:25rpx; border-radius: 8rpx; height:35rpx; line-height:35rpx; padding: 4rpx 16rpx;"
            })
          }, {
            j: item.dutyStatus == 1
          }, item.dutyStatus == 1 ? {} : {}, {
            k: item.dutyStatus == 2
          }, item.dutyStatus == 2 ? {} : {}, {
            l: item.dutyStatus == 3
          }, item.dutyStatus == 3 ? {
            m: common_vendor.t(item.reportStatus == 0 ? "（未报备）" : "（已报备）")
          } : {}, {
            n: common_vendor.t(item.communityName),
            o: common_vendor.t(item.phonenumber),
            p: common_vendor.o(($event) => common_vendor.unref(utils_tools.callPhone)(item.phonenumber), index),
            q: common_vendor.o(($event) => scanClockRecord(item.policeUserId), index),
            r: index,
            s: "175db4df-1-" + i0 + ",175db4df-0"
          });
        })
      } : {
        c: common_vendor.p({
          mode: "data",
          text: "暂无数据",
          icon: "http://cdn.uviewui.com/uview/empty/data.png"
        })
      }, {
        d: common_vendor.p({
          height: "10"
        }),
        e: common_vendor.o(scrolltolower),
        f: common_vendor.p({
          height: "100vh"
        })
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-175db4df"]]);
wx.createPage(MiniProgramPage);
